package com.sunthy.mall.dao.admin;


import com.sunthy.mall.model.admin.bo.order.OrdersByPageBO;
import com.sunthy.mall.model.admin.pojo.order.Orders;
import com.sunthy.mall.model.admin.vo.client.order.OrderCarBo;
import com.sunthy.mall.model.admin.vo.order.OrdersByPageInnerOrderVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 对数据库进行增删改查的操作
 */
public interface OrderDao {

    int getTotalCount(OrdersByPageBO ordersByPageBO);

    List<OrdersByPageInnerOrderVO> ordersByPage(OrdersByPageBO ordersByPageBO);

    Orders selOrderById(Integer id);

    /**
     * 修改order
     *
     * @param orders
     * @return 修改的行数
     */
    int orderChange(@Param("orders") Orders orders);

    void deleteOrder(Integer id);

    /**
     * 添加order
     *
     * @param orders
     * @return interesting
     */
    int addOrder(@Param("orders") Orders orders);

    /**
     * 根据userId , state查找order
     *
     * @param userId
     * @param state
     * @return List<OrderCarBo>
     */
    List<Orders> selOrderByUserIdAndState(@Param("userId") Integer userId, @Param("state") Integer state);

    /**
     * 支付订单
     * @param id
     * @return
     */
    int changeOrderStateToPay(Integer id);
}
